<?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

// Model:'NguoiDung' - Database Table: 'nguoi_dung'

Class NguoiDung extends Eloquent implements UserInterface, RemindableInterface {

    protected $table = 'nguoi_dung';
    protected $hidden = array('password');
    public static $rules = array(
        'tai_khoan' => 'required|min:4|max:10',
        'password' => 'required|min:3'
    );

    public static function validate($data) {
        return Validator::make($data, static::$rules);
    }

    public function getAuthIdentifier() {
        return $this->getKey();
    }

    public function getAuthPassword() {
        return $this->password;
    }

    public function getReminderEmail() {
        return $this->email;
    }

    public function canbo() {
        return $this->belongsToMany('CanBo');
    }

    public function lichsuhoatdong() {
        return $this->belongsToMany('LichSuHoatDong');
    }

    public function sinhvien() {
        return $this->belongsToMany('SinhVien');
    }

    public function thongbao() {
        return $this->belongsToMany('ThongBao');
    }

}